import { defineStore } from "pinia";
import {ref} from 'vue';
import { getUserInfoByAccount } from "../api/Login";

export const useUserStore = defineStore('userStore',()=>{
    //用户的基础信息
    const userInfo = ref({});


    const setUserInfo = async (id)=>{
        const rows = await getUserInfoByAccount(id);
        console.log(rows);
        
        if(rows.code == 200){
            userInfo.value = rows.data;
            console.log(userInfo.value.username);
            
        }
       
    }
    return {userInfo,setUserInfo};
})